mui.init();
var deceleration = mui.os.ios?0.003:0.0009;
	mui('.mui-scroll-wrapper').scroll({
		bounce: false,
		indicators: true, //是否显示滚动条
		deceleration:deceleration
	});
mui.ready(function() {
	//渲染全部
	mui('#item1mobile').pullToRefresh({
			up: {
				callback: function() {
					var self=this;
					var ul = self.element.querySelector('.contentBox');
					setTimeout(function() {
					ul.appendChild(createFragment1(ul, 0, 5));
					self.endPullUpToRefresh();
					}, 1000);
				}
			}
		});
	var createFragment1 = function(ul, index, count, reverse) {
		var length = ul.querySelectorAll('.content').length;
		var fragment1 = document.createDocumentFragment();
		var contentAll;
//	    mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/register',{
//	    	data:{
//	    		count:count,
//	    	},
//	    	dataType:'json',
//	    	type:'post',
//	    	headers:{'Content-Type':'application/json'},
//	    	success:function(data){
//	    		JSON.stringify(data);
//	    		console.log(data.code)
//	    		if(data.code==401){
	    		for (var  i = 0; i < count; i++) {
	    			contentAll = document.createElement('div');
					contentAll.className="content";
					contentAll.innerHTML=`
					<main>
				    		<div class="lists">	
				    			<div class="clist-title">
				    				<ul class="clist-title-left">
					    				<li>
					    					<a href="" class="authorList" >
					    						<img src="img/banner.png" alt="" />
					    					</a>	
					    				</li>
					    				<li>芝士</li>
					    				<li>单图</li>
				    				</ul>
				    				<li>一分钟前</li>
				    			</div>
				    		   <!--主题图片-->
				    		   <a href="javascript:void(0)" class="clist-imgBox" style="display: block;">
				    		   	   <img src="img/aimg.png" alt="" class="clist-img"/>
				    		   </a>
				    		   <div class="imgtitle">酉游记—最终版</div>
				    		   <!--底部分享等列表-->
				    		   <ul class="clist-operation">
				    		   	<li>
				    		   	   <img src="img/icon_zhuanfa_d@2x.png" alt=""  style="width:0.34rem;height:0.34rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_soucang@2x.png" alt="" style="width:0.28rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_comment@2x.png" alt="" style="width:0.32rem;height:0.30rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_zan@2x.png" alt="" style="width:0.32rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   </ul>
				    		</div>
				</main>
					`
			;
				    fragment1.appendChild(contentAll);
				}
//	    		}else{
//	    			mui.toast(data.message);
//	    		}
//	    	},
//	    	error:function(xhr,type,errorThrown){
//	    		console.log(xhr);
//	    	}
//	    })
	    return fragment1;
	};
	//渲染推荐
	mui('#item2mobile').pullToRefresh({
			up: {
				callback: function() {
					var self=this;
					var ul = self.element.querySelector('.contentBox');
					setTimeout(function() {
					ul.appendChild(createFragment2(ul, 0, 5));
					self.endPullUpToRefresh();
					}, 1000);
				}
			}
		});
	var createFragment2 = function(ul, index, count, reverse) {
		var length = ul.querySelectorAll('.content').length;
		var fragment2 = document.createDocumentFragment();
		var contentAll;
//	    mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/register',{
//	    	data:{
//	    		count:count,
//	    	},
//	    	dataType:'json',
//	    	type:'post',
//	    	headers:{'Content-Type':'application/json'},
//	    	success:function(data){
//	    		JSON.stringify(data);
//	    		console.log(data.code)
//	    		if(data.code==401){
	    		for (var  i = 0; i < count; i++) {
	    			contentAll = document.createElement('div');
					contentAll.className="content";
					contentAll.innerHTML=`
					<main>
				    		<div class="lists">	
				    			<div class="clist-title">
				    				<ul class="clist-title-left">
					    				<li>
					    					<a href="" class="authorList" >
					    						<img src="img/banner.png" alt="" />
					    					</a>	
					    				</li>
					    				<li>芝士</li>
					    				<li>单图</li>
				    				</ul>
				    				<li>一分钟前</li>
				    			</div>
				    		   <!--主题图片-->
				    		   <a href="javascript:void(0)" class="clist-imgBox" style="display: block;">
				    		   	   <img src="img/aimg.png" alt="" class="clist-img"/>
				    		   </a>
				    		   <div class="imgtitle">酉游记—最终版</div>
				    		   <!--底部分享等列表-->
				    		   <ul class="clist-operation">
				    		   	<li>
				    		   	   <img src="img/icon_zhuanfa_d@2x.png" alt=""  style="width:0.34rem;height:0.34rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_soucang@2x.png" alt="" style="width:0.28rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_comment@2x.png" alt="" style="width:0.32rem;height:0.30rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_zan@2x.png" alt="" style="width:0.32rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   </ul>
				    		</div>
				</main>
					`
			;
				    fragment2.appendChild(contentAll);
				}
//	    		}else{
//	    			mui.toast(data.message);
//	    		}
//	    	},
//	    	error:function(xhr,type,errorThrown){
//	    		console.log(xhr);
//	    	}
//	    })
	    return fragment2;
	};
	//渲染单图
	mui('#item3mobile').pullToRefresh({
			up: {
				callback: function() {
					var self=this;
					var ul = self.element.querySelector('.contentBox');
					setTimeout(function() {
					ul.appendChild(createFragment3(ul, 0, 5));
					self.endPullUpToRefresh();
					}, 1000);
				}
			}
		});
	var createFragment3 = function(ul, index, count, reverse) {
		var length = ul.querySelectorAll('.content').length;
		var fragment3 = document.createDocumentFragment();
		var contentAll;
//	    mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/register',{
//	    	data:{
//	    		count:count,
//	    	},
//	    	dataType:'json',
//	    	type:'post',
//	    	headers:{'Content-Type':'application/json'},
//	    	success:function(data){
//	    		JSON.stringify(data);
//	    		console.log(data.code)
//	    		if(data.code==401){
	    		for (var  i = 0; i < count; i++) {
	    			contentAll = document.createElement('div');
					contentAll.className="content";
					contentAll.innerHTML=`
					<main>
				    		<div class="lists">	
				    			<div class="clist-title">
				    				<ul class="clist-title-left">
					    				<li>
					    					<a href="" class="authorList" >
					    						<img src="img/banner.png" alt="" />
					    					</a>	
					    				</li>
					    				<li>芝士</li>
					    				<li>单图</li>
				    				</ul>
				    				<li>一分钟前</li>
				    			</div>
				    		   <!--主题图片-->
				    		   <a href="javascript:void(0)" class="clist-imgBox" style="display: block;">
				    		   	   <img src="img/aimg.png" alt="" class="clist-img"/>
				    		   </a>
				    		   <div class="imgtitle">酉游记—最终版</div>
				    		   <!--底部分享等列表-->
				    		   <ul class="clist-operation">
				    		   	<li>
				    		   	   <img src="img/icon_zhuanfa_d@2x.png" alt=""  style="width:0.34rem;height:0.34rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_soucang@2x.png" alt="" style="width:0.28rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_comment@2x.png" alt="" style="width:0.32rem;height:0.30rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_zan@2x.png" alt="" style="width:0.32rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   </ul>
				    		</div>
				</main>
					`
			;
				    fragment3.appendChild(contentAll);
				}
//	    		}else{
//	    			mui.toast(data.message);
//	    		}
//	    	},
//	    	error:function(xhr,type,errorThrown){
//	    		console.log(xhr);
//	    	}
//	    })
	    return fragment3;
	};
	//渲染图集
	mui('#item4mobile').pullToRefresh({
			up: {
				callback: function() {
					var self=this;
					var ul = self.element.querySelector('.contentBox');
					setTimeout(function() {
					ul.appendChild(createFragment4(ul, 0, 5));
					self.endPullUpToRefresh();
					}, 1000);
				}
			}
		});
	var createFragment4 = function(ul, index, count, reverse) {
		var length = ul.querySelectorAll('.content').length;
		var fragment4 = document.createDocumentFragment();
		var contentAll;
//	    mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/register',{
//	    	data:{
//	    		count:count,
//	    	},
//	    	dataType:'json',
//	    	type:'post',
//	    	headers:{'Content-Type':'application/json'},
//	    	success:function(data){
//	    		JSON.stringify(data);
//	    		console.log(data.code)
//	    		if(data.code==401){
	    		for (var  i = 0; i < count; i++) {
	    			contentAll = document.createElement('div');
					contentAll.className="content";
					contentAll.innerHTML=`
					<main>
				    		<div class="lists">	
				    			<div class="clist-title">
				    				<ul class="clist-title-left">
					    				<li>
					    					<a href="" class="authorList" >
					    						<img src="img/banner.png" alt="" />
					    					</a>	
					    				</li>
					    				<li>芝士</li>
					    				<li>图集</li>
				    				</ul>
				    				<li>一分钟前</li>
				    			</div>
				    		   <!--主题图片-->
				    		   <a href="javascript:void(0)" class="clist-imgBox" style="display: block;">
				    		   	   <img src="img/aimg.png" alt="" class="clist-img"/>
				    		   </a>
				    		   <div class="imgtitle">酉游记—最终版</div>
				    		   <!--底部分享等列表-->
				    		   <ul class="clist-operation">
				    		   	<li>
				    		   	   <img src="img/icon_zhuanfa_d@2x.png" alt=""  style="width:0.34rem;height:0.34rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_soucang@2x.png" alt="" style="width:0.28rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_comment@2x.png" alt="" style="width:0.32rem;height:0.30rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   	<li>
				    		   	   <img src="img/icon_zan@2x.png" alt="" style="width:0.32rem;height:0.28rem"/>
				    		   	   <span>69</span>
				    		   	</li>
				    		   </ul>
				    		</div>
				</main>
					`
			;
				    fragment4.appendChild(contentAll);
				}
//	    		}else{
//	    			mui.toast(data.message);
//	    		}
//	    	},
//	    	error:function(xhr,type,errorThrown){
//	    		console.log(xhr);
//	    	}
//	    })
	    return fragment4;
	};
	//渲染文章
	mui('#item5mobile').pullToRefresh({
			up: {
				callback: function() {
					var self=this;
					var articleContent = self.element.querySelector('.article-content');
					setTimeout(function() {
					articleContent.appendChild(createFragment5(articleContent, 0, 5));
					self.endPullUpToRefresh();
					}, 1000);
				}
			}
		});
	var createFragment5 = function(ul, index, count, reverse) {
		var length = ul.querySelectorAll('.articleListBox').length;
		var fragment5 = document.createDocumentFragment();
		var contentAll;
//	    mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/register',{
//	    	data:{
//	    		count:count,
//	    	},
//	    	dataType:'json',
//	    	type:'post',
//	    	headers:{'Content-Type':'application/json'},
//	    	success:function(data){
//	    		JSON.stringify(data);
//	    		console.log(data.code)
//	    		if(data.code==401){
	    		for (var  i = 0; i < count; i++) {
	    			contentAll = document.createElement('div');
					contentAll.className="articleListBox";
					contentAll.innerHTML=`
					 <main>
											    	    	<ul class="articleList">
												    	   	   <li>
												    	   	   	  <div class="articleList-title">
												    	   	   	  	<a href="">如何成为一个优秀的插画师</a>
												    	   	   	  	<div class="articleList-clssify">文章</div>
												    	   	   	  </div>
												    	   	   	  <div class="articleList-author">
												    	   	   	  	<span>By</span>
												    	   	   	  	<span>我好像生病了</span>
												    	   	   	  </div>
												    	   	   	  <div class="articleList-info">
												    	   	   	  	  <a href="" style="display: inline-block;" >
												    	   	   	  	  	毕业到现在一直做各种设计，由于工作的设计内容比较散，所以每次设计的时候经常会拿到设...
												    	   	   	  	  </a>
												    	   	   	  </div>
												    	   	   </li>
												    	   	   <li class="articleList-img">
												    	   	   	  <a href="" style="display: block;"><img src="img/aimg.png" alt="" /></a>
												    	   	   </li>
											    	   	   </ul>
											    	   	   <!--底部分享等列表-->
											    		   															<!--底部分享等列表-->
												    		   <ul class="clist-operation">
												    		   	<li>
												    		   	   <img src="img/icon_zhuanfa_d@2x.png" alt=""  style="width:0.34rem;height:0.34rem"/>
												    		   	   <span>69</span>
												    		   	</li>
												    		   	<li>
												    		   	   <img src="img/icon_soucang@2x.png" alt="" style="width:0.28rem;height:0.28rem"/>
												    		   	   <span>69</span>
												    		   	</li>
												    		   	<li>
												    		   	   <img src="img/icon_comment@2x.png" alt="" style="width:0.32rem;height:0.30rem"/>
												    		   	   <span>69</span>
												    		   	</li>
												    		   	<li>
												    		   	   <img src="img/icon_zan@2x.png" alt="" style="width:0.32rem;height:0.28rem"/>
												    		   	   <span>69</span>
												    		   	</li>
												    		   </ul>
											    		   </main>
					`
			;
				    fragment5.appendChild(contentAll);
				}
//	    		}else{
//	    			mui.toast(data.message);
//	    		}
//	    	},
//	    	error:function(xhr,type,errorThrown){
//	    		console.log(xhr);
//	    	}
//	    })
	    return fragment5;
	};
	//渲染礼赞
	mui('#item6mobile').pullToRefresh({
			up: {
				callback: function() {
					var self = this;
					setTimeout(function() {
						var praiseContent = self.element.querySelector('.praise-content');
						praiseContent.appendChild(createFragment6(praiseContent, 0, 5));
						self.endPullUpToRefresh();
					}, 1000);
				}
			}
	});
	var createFragment6 = function(ul, index, count, reverse) {
		var lists = ul.querySelectorAll('.lists').length;
		var fragment6 = document.createDocumentFragment();
		var userList;
//	    mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/register',{
//	    	data:{
//	    		count:count,
//	    	},
//	    	dataType:'json',
//	    	type:'post',
//	    	headers:{'Content-Type':'application/json'},
//	    	success:function(data){
//	    		JSON.stringify(data);
//	    		if(data.code==401){
	    		for (let i = 0; i < count; i++) {
	    			lists = document.createElement('div');
					lists.className="lists";
					lists.innerHTML=`
			    		  <main>
				    			<div class="clist-title">
				    				<ul class="clist-title-left">
					    				<li>
					    					<a href="" class="authorList" style="display:flex; ">
					    						<img src="img/banner.png" alt="" />
					    					</a>	
					    				</li>
					    				<li>芝士</li>
				    				</ul>
				    				<li>一分钟前</li>
				    			</div>
				    		   <!--主题图片-->
				    		   <a href="" class="clist-imgBox" style="display: flex;">
				    		   	   <img src="img/aimg.png" alt="" class="clist-img"/>
				    		   </a>
				    		   <div class="imgtitle">酉游记—最终版</div>
				    		 <!--底部分享等列表-->
					    		   <ul class="clist-operation">
					    		   	<li>
					    		   	   <img src="img/icon_zhuanfa_d@2x.png" alt=""  style="width:0.34rem;height:0.34rem"/>
					    		   	   <span>69</span>
					    		   	</li>
					    		   	<li>
					    		   	   <img src="img/icon_soucang@2x.png" alt="" style="width:0.28rem;height:0.28rem"/>
					    		   	   <span>69</span>
					    		   	</li>
					    		   	<li>
					    		   	   <img src="img/icon_comment@2x.png" alt="" style="width:0.32rem;height:0.30rem"/>
					    		   	   <span>69</span>
					    		   	</li>
					    		   	<li>
					    		   	   <img src="img/icon_zan@2x.png" alt="" style="width:0.32rem;height:0.28rem"/>
					    		   	   <span>69</span>
					    		   	</li>
					    		   </ul>
				    		   </main>
			`;
				fragment6.appendChild(lists);
				}
//	    		}else{
//	    			mui.toast(data.message);
//	    		}
//	    	},
//	    	error:function(xhr,type,errorThrown){
//	    		console.log(xhr);
//	    	}
//	    })
	    return fragment6;
	};
	//渲染文章
	mui('#item7mobile').pullToRefresh({
			up: {
				callback: function() {
					var self = this;
					setTimeout(function() {
						var userBox = self.element.querySelector('.userBox');
						userBox.appendChild(createFragment7(userBox, 0, 5));
						self.endPullUpToRefresh();
					}, 1000);
				}
			}
		});
	var createFragment7 = function(ul, index, count, reverse) {
		var length = ul.querySelectorAll('.userlist').length;
		var fragment7 = document.createDocumentFragment();
		var userList;
//	    mui.ajax('http://moyu.youledi.cn/moyu/Api/Login/register',{
//	    	data:{
//	    		count:count,
//	    	},
//	    	dataType:'json',
//	    	type:'post',
//	    	headers:{'Content-Type':'application/json'},
//	    	success:function(data){
//	    		JSON.stringify(data);
//	    		if(data.code==401){
	    		for (let i = 0; i < count; i++) {
	    			userList = document.createElement('div');
					userList.className="content";
					userList.style.cssText="padding: 0.3rem 0.24rem; margin-bottom: 0.1rem;background: #fff;";
					userList.innerHTML=`
			    			<ul class="authorBox">
			    				<a href="javascript:void(0)" class="authorList">
			    					<img src="img/aimg.png" alt="" />
			    				</a>
			    				<!--用户名等-->
								<div class="authorname">
									<div style="display: flex;"><a href="">还是一碗泡面</a></div>
									<div style="display: flex;">
										<p class="author-font">作品</p>
										<p class="author-num">12</p>
										<p style="width:0.02rem;height:0.2rem;background: #CCCCCC;"></p>
										<p class="author-font">粉丝</p>
										<p class="author-num">110</p>
									</div>
								</div>
								<div class="guanzhu">关注</div>
			    			</ul>
			    			<!--文章列表-->
			                <ul class="articleList">
			    				<li>
			    					<a href="" style="display:block;">
			    						<img src="img/aricle1.png" alt="" />
			    					</a>
			    				</li>
			    				<li>
			    					<a href="" style="display:block;">
			    						<img src="img/aricle1.png" alt="" />
			    					</a>
			    				</li>
			    				<li>
			    					<a href="" style="display:block;">
			    						<img src="img/aricle1.png" alt="" />
			    					</a>
			    				</li>
			    				<li>
			    					<a href="" style="display:block;">
			    						<img src="img/aricle1.png" alt="" />
			    					</a>
			    				</li>
			    			</ul>
			`;
				fragment7.appendChild(userList);
				}
//	    		}else{
//	    			mui.toast(data.message);
//	    		}
//	    	},
//	    	error:function(xhr,type,errorThrown){
//	    		console.log(xhr);
//	    	}
//	    })
	    return fragment7;
	};
});
